//
//  NSString+Ext.h
//  Qilekang
//
//  Created by YULING MINA on 14-7-15.
//  Copyright (c) 2014年 Qilekang. All rights reserved.
//

#import <Foundation/Foundation.h>

#define LABEL_LINE_SPACE        2   // 行间距

@interface NSString (MD5)

/**
 *  MD5加密
 *
 *  @return 加密后字符串
 */
- (NSString *)MD5EncodingString;
+(NSString*)RC4EncodingWithKey:(NSString*)aInput key:(NSString*)aKey;
@end

@interface NSString (base64)

/**
 *  base64加密
 *
 *  @return 加密有字符串
 */
- (NSString *)base64EncodingString;

@end

@interface NSString (SHA1)

/**
 *  SHA1加密
 *
 *  @param key 密钥
 *
 *  @return
 */
- (NSData *)HMACSHA1EncodeDataWithKey:(NSString *)key;

@end

@interface NSString (url)

/**
 *  urlencode
 *
 *  @return encode后字符串
 */
- (NSString *)URLEncodingString;

/**
 *  urldecode
 *
 *  @return decode后字符串
 */
- (NSString *)URLDecodingString;

@end

@interface NSString (Regex)

/**
 *  是否是手机号码
 *
 *  @return YES or NO
 */
- (BOOL)isMobileNumber;

@end

@interface NSString (Device)

/**
 *  手机IMEI
 *
 *  @return
 */
+ (NSString *)imei;

/**
 *  手机MAC地址
 *
 *  @return 
 */
+ (NSString *)macAddress;


-(NSString *)customBase64Encoding;
+ (NSString *)getCurrentVersion;
@end

@interface NSString (Emoji)

+ (NSString* )getExpressionStrById:(int)idx;

+(NSString*)getExpressionById:(int)idx;
+ (NSString *)getDeviceName;
+ (NSString *)convert2ShortTime:(NSTimeInterval)secs;

- (NSDictionary*)coverDictionary;

// 保存到本地磁盘
- (void)toLocalDiskForKey:(NSString *)key;
//路径转换到缓存中自定义的文件夹中

- (NSString*)coverDirToCacheDir;
 @end

@interface NSString (DBPath)
/**
 *  获取沙盒绝对文件名
 *
 *  @return 沙盒绝对路径名
 */
+ (NSString *) userIdExclusiveDirectionWithUserId ;
/**
 *  userId获取绝对文件名
 *
 *  @return 文件名
 */
+ (NSString *) userIdExclusiveDirectionWithUserId : (NSString *) userId;
+(BOOL)isNotEmpty:(NSString*)string;
@end

@interface NSString (heightOrWidth)
/**
 *返回值是该字符串所占的大小(width, height)
 *font : 该字符串所用的字体(字体大小不一样,显示出来的面积也不同)
 *maxSize : 为限制字体的最大宽和高(如果显示一行,则宽高都设置为MAXFLOAT, 如果显示为多行,只需将宽设置一个有限定长值,高设置为MAXFLOAT)
 */
-(CGSize)sizeWithFont:(UIFont *)font maxSize:(CGSize)maxSize;
@end

@interface NSString (attributeString)
/** 
 *转为NSMutableAttributedString
 *return NSMutableAttributedString
 */
- (NSMutableAttributedString* )toAttributeString;

/**
 *带横划线的字符串-中间
 */
- (NSMutableAttributedString *)getAttributeStringWithMinddleLine;

/**
 *带横划线的字符串-底部
 */
- (NSMutableAttributedString *)getAttributeStringWithBottomLine;

@end

@interface NSString (filePathExt)
/**
 *缩略图路径
 */
- (NSString*)toThumbnail;

- (NSString*)trimmingLeadingAndTrailingWhitespace;

@end
